package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import com.example.demo.conf.AutoConfiguration;
import com.example.demo.conf.TestConfiguration;

@SpringBootApplication
public class DemoApplication {

	public static void main(String[] args){
		ConfigurableApplicationContext context=SpringApplication.run(DemoApplication.class, args);
		context.getBean(TestConfiguration.class).show();;
		System.out.println("");
		context.getBean(AutoConfiguration.class).show();
		System.out.println("线程准备启动。。。");
		Runnable myRun=new Runnable(){
			@Override
			public void run() {
				// TODO Auto-generated method stub
				System.out.println("==============");
				System.out.println("线程a已经启动。。。");
				System.out.println("==============");
				int i=0;
				while(true){
//					System.out.println("我会一直在后台运行"+i);
					try {
						Thread.currentThread().sleep(5000);
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					i=i+1;
				}
			}
		};
		Thread th=new Thread(myRun,"线程测试");
		th.start();
		System.out.println("线程名称="+th.getName());
		
	}
}
